package test01;

import java.util.TreeSet;

/*
1.新建两个javaBean
	Student
		String sid
		String name
	Teacher
		String tid
		String name
		TreeSet<Student> tsStudent
	一个老师可以有多个学生。
	请用TreeSet实现，添加两个老师对象，每个老师下各添加五个学生对象
	打印输出TreeSet集合，要求：
	老师对象按工号的升序，姓名的降序排序，学生对象按学号的降序，姓名的升序排序
 */
public class Test01 {
    public static void main(String[] args) {
        TreeSet<Student> treeSet1 = new TreeSet<>();
        Student stu1 = new Student("001", "学生one");
        Student stu2 = new Student("002", "学生two");
        Student stu3 = new Student("003", "学生three");
        Student stu4 = new Student("004", "学生four");
        Student stu5 = new Student("005", "学生five");
        treeSet1.add(stu1);
        treeSet1.add(stu2);
        treeSet1.add(stu3);
        treeSet1.add(stu4);
        treeSet1.add(stu5);
        Teacher teacher1 = new Teacher("101", "张三", treeSet1);

        TreeSet<Student> treeSet2 = new TreeSet<>();
        Student stu6 = new Student("006", "学生six");
        Student stu7 = new Student("007", "学生seven");
        Student stu8 = new Student("008", "学生eight");
        Student stu9 = new Student("009", "学生nine");
        Student stu10 = new Student("010", "学生ten");
        treeSet2.add(stu6);
        treeSet2.add(stu7);
        treeSet2.add(stu8);
        treeSet2.add(stu9);
        treeSet2.add(stu10);
        Teacher teacher2 = new Teacher("103", "李四", treeSet2);

        TreeSet<Teacher> teachers = new TreeSet<>();
        teachers.add(teacher1);
        teachers.add(teacher2);
        for (Teacher teacher : teachers) {
            System.out.println(teacher);
        }
    }
}
